import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n= sc.nextInt();
        hanoi(n,'A','B','C');
    }
    public static void move(char A,char B){
        System.out.println(A+"->"+B);
    }
    public static void hanoi(int n,char A,char B,char C){
        if(n==1){
            move(A,C);
        }
        else {
            hanoi(n - 1, A, C, B);//将A柱上的前n-1个盘子借助C柱移动到B柱
            move(A, C);//将A柱剩余的一个盘子移动到C柱
            hanoi(n - 1, B, A, C);//将B柱上的n-1个盘子借助A柱移动到C柱
        }
    }
    public static int sum1(int a,int b){
        return a+b;
    }
    public static double sum2(double a,double b,double c){
        return a+b+c;
    }
    public static int max2(int a,int b){
        return a>b?a:b;
    }
    public static double max2(double a,double b){
        return a>b?a:b;
    }
    public static int max3(int a,int b,int c){
        int n=max2(a,b);
        return max2(n,c);
    }
}